#	$Header: /cvsroot/osrs/libtiff/html/Makefile.in,v 1.8 2002/10/02 15:09:14 dron Exp $
#
# @WARNING@
#
# Tag Image File Format Library Manual Pages
#
# Copyright (c) 1991-1997 Sam Leffler
# Copyright (c) 1991-1997 Silicon Graphics, Inc.
# 
# Permission to use, copy, modify, distribute, and sell this software and 
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Stanford and Silicon Graphics.
# 
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
# 
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
# OF THIS SOFTWARE.
#
DEPTH		= ..

SRCDIR		= ${DEPTH}/@SRCDIR@/html
VPATH		= ../@SRCDIR@/html

PORT		= ${DEPTH}/port

#
# VERSION:	@VERSION@
# DATE:		@DATE@
# TARGET:	@TARGET@
# CCOMPILER:	@CCOMPILER@
#
SHELL		= @SCRIPT_SH@
SCRIPT_SH 	= @SCRIPT_SH@
NULL		=
ECHO		= echo
MV		= mv
RM		= rm -f
INSTALL		= @INSTALL@
GROFF		= groff  -Thtml -mandoc
NROFF		= nroff  -Tlatin1 -mandoc
MAN2HTML	= man2html -cgiurl ./\$$title.\$$section\$$subsection.html

MANSRCDIR	= @RELSRCDIR@/man
HTML		= @DIR_HTML@

HTMLFILES=\
	TIFFTechNote2.html	\
	bugs.html		\
	build.html		\
	contrib.html		\
	document.html		\
	images.html		\
	index.html		\
	internals.html		\
	intro.html		\
	libtiff.html		\
	misc.html		\
	support.html		\
	tools.html		\
	v3.4beta007.html	\
	v3.4beta016.html	\
	v3.4beta018.html	\
	v3.4beta024.html	\
	v3.4beta028.html	\
	v3.4beta029.html	\
	v3.4beta031.html	\
	v3.4beta032.html	\
	v3.4beta033.html	\
	v3.4beta034.html	\
	v3.4beta035.html	\
	v3.4beta036.html	\
	v3.5.1.html		\
	v3.5.2.html		\
	v3.5.3.html		\
	v3.5.4.html		\
	v3.5.5.html		\
	v3.5.6-beta.html	\
	v3.5.7.html		\
	${NULL}
IMAGES=\
	images/back.gif		\
	images/bali.jpg		\
	images/cat.gif		\
	images/cover.jpg	\
	images/cramps.gif	\
	images/dave.gif	\
	images/info.gif	\
	images/jello.jpg	\
	images/jim.gif		\
	images/note.gif		\
	images/oxford.gif	\
	images/quad.jpg		\
	images/ring.gif		\
	images/smallliz.jpg	\
	images/strike.gif	\
	images/warning.gif	\
	${NULL}
TARGETS=

all:	${TARGETS}

install: all
	${INSTALL} -m 755 -dir -idb tiff.man.html ${DESTDIR}${HTML} ${DESTDIR}${HTML}/images
	for i in ${HTMLFILES} ${IMAGES}; do \
	    ${INSTALL} -idb tiff.man.html -m 444 -F ${DESTDIR}${HTML} \
		-src ${SRCDIR}/$$i -O $$i; \
	done

clean:;

INDEXSTART	= '<HTML><HEAD><TITLE>Libtiff HTML manpage index</TITLE></HEAD><BODY BGCOLOR=white><ul><H2>Man Pages</h2><p>'
INDEXEND	= '</ul></BODY></HTML>'

# Rebuild HTML representation of the manual pages using groff
groffhtml:
	test -d man || mkdir man
	${ECHO} ${INDEXSTART} > ${SRCDIR}/man/index.html
	# build function pages
	for i in ${MANSRCDIR}/*.3t; do					\
		${GROFF} $$i > ${SRCDIR}/man/`basename $$i`.html;	\
		${ECHO} '<li><A HREF='`basename $$i`'.html>'`basename $$i`'</a>' >> ${SRCDIR}/man/index.html;	\
	done
	# build tools pages
	for i in ${MANSRCDIR}/*.1; do					\
		${GROFF} $$i > ${SRCDIR}/man/`basename $$i`.html;	\
		${ECHO} '<li><A HREF='`basename $$i`'.html>'`basename $$i`'</a>' >> ${SRCDIR}/man/index.html;	\
	done
	${ECHO} ${INDEXEND} >> ${SRCDIR}/man/index.html

# The same but using man2html
# This approach has advantage of the crossreference links
html:
	test -d man || mkdir man
	${ECHO} ${INDEXSTART} > ${SRCDIR}/man/index.html
	# build function pages
	for i in ${MANSRCDIR}/*.3t; do					\
		${NROFF} $$i | ${MAN2HTML} > ${SRCDIR}/man/`basename $$i`.html;	\
		${ECHO} '<li><A HREF='`basename $$i`'.html>'`basename $$i`'</a>' >> ${SRCDIR}/man/index.html;	\
	done
	# build tools pages
	for i in ${MANSRCDIR}/*.1; do					\
		${NROFF} $$i | ${MAN2HTML} > ${SRCDIR}/man/`basename $$i`.html;	\
		${ECHO} '<li><A HREF='`basename $$i`'.html>'`basename $$i`'</a>' >> ${SRCDIR}/man/index.html;	\
	done
	${ECHO} ${INDEXEND} >> ${SRCDIR}/man/index.html


